package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.Consultant;
import com.sfzy.mapper.ConsultantMapper;
import com.sfzy.service.ConsultantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultantServiceImpl implements ConsultantService {
    @Autowired
    private ConsultantMapper consultantMapper;

    @Override
    public int insertConsultant(Consultant consultant) {
        return consultantMapper.insertConsultant(consultant);
    }

    @Override
    public int deleteConsultant(int id) {
        return consultantMapper.deleteConsultant(id);
    }

    @Override
    public int updateConsultant(Consultant consultant) {
        return consultantMapper.updateConsultant(consultant);
    }

    @Override
    public Consultant selectConsultantById3(int id) {
        return consultantMapper.selectConsultantById3(id);
    }

    @Override
    public PageInfo<Consultant> selectConsultants3(Consultant consultant, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Consultant> consultants = consultantMapper.selectConsultants3(consultant);
        PageInfo<Consultant> pageInfo = new PageInfo<>(consultants);
        return pageInfo;
    }
}
